package cn.com.api.service;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import cn.com.api.entity.ApiGoods;
import cn.com.api.entity.ApiGoodsTopicLink;
import cn.com.api.entity.ApiGoods_p;
import cn.com.api.entity.ApiSpeicalChang;
import cn.com.api.resultpage.GoodsPage;
import cn.com.util.PageInfo;

@Service
public interface ApiGoodsService {
	// 根据条件查询商品
	public List<Map<String, Object>> getGoodsByType(Object goods_type, Object obj);

	// 默认查询商品
	public List<Map<String, Object>> getGoodsDef();

	// 根据id查询商品详情
	public List<Map<String, Object>> getGoods(Object id);

	public List<Map<String, Object>> searActGoodsListPage(Map<String, Object> conditions, PageInfo pageInfo);

	// 根据活动商品列表根据类型
	public List<Map<String, Object>> searActGoodsByTypeListPage(Map<String, Object> conditions, PageInfo pageInfo);

	// 搜索商品
	public List<Map<String, Object>> searchGoods(String name, String cityid);

	// 搜索店铺
	public List<Map<String, Object>> searchShops(String name, String cityid);

	// 图文详情
	public List<Map<String, Object>> imageDetail(Object id);

	// 根据产品类型选择商品---根据二级分类选择--默认给出第一个的商品列表
	public List<ApiGoods> serchGoodsByParType(int par_type);

	// 根据产品类型选择商品---根据二级分类选择--默认给出第一个的商品列表
	public List<Map<String, Object>> serchGoodsByType(int type, int city_id);

	public void searchGoodsByShopId(Map<String, String> params, Map<String, Object> map, PageInfo page)
			throws Exception;

	public List<ApiGoods> serchGoodsByPromotionType(int type, PageInfo pi);

	// 查询我收藏的商品
	public List<ApiGoods> searchMyGoods(String u_id);

	// 推荐商品
	public List<ApiGoods> tuijianGoods(String type, String cityid);

	// 根据id查看
	public ApiGoods findT_goodsById(Long id);

	public Map<String, Object> getGoodsByProductId(String productid);

	public List<ApiGoods> findT_goodsListOrderById();

	public List<ApiGoods> searchGoods(Map<String, Object> conditions, PageInfo pageInfo);

	// 添加
	public int insertT_goods(ApiGoods t_good);

	public int insertT_goodsAll(ApiGoods t_good, String products_list, String image_list, String[] detialPics,
			String[] goodstagsid);

	public int insertT_goodsAll4erp(ApiGoods t_good);

	// 修改
	public int updateT_goods(ApiGoods t_good);

	// 同步erp信息
	public int updateT_goods4erp(ApiGoods t_good);

	public int updateT_goodsAll(ApiGoods t_good, String products_list, String image_list, String image_list_del,
			String[] delteIds, String[] detialPics);

	// 删除
	public int deleteT_goods(Integer id);

	// 添加商品图片
	public void insertGoods_p(ApiGoods_p goods_p);

	public List<ApiGoods_p> findGoods_pByGoodsId(Long goods_id);

	public List<ApiGoods_p> findAllGoodsPByGoodsId(Long goods_id);

	public ApiGoods searchGoodsById(Long id);

	public List<ApiGoods> searchGoodsByShop(int shop_id);

	/*********** syy start ************************/

	public List<GoodsPage> searchGoodsByGoodsIds(Integer did, String goods_ids);

	public List<GoodsPage> searchGoodsByOrderId(Integer did);

	// 商铺端-根据商品类型和shop_id 查询店铺某一分类的商品
	public void shopSearchGoodsByType(Map<String, String> params, Map<String, Object> map);

	// 修改商品的上下架状态
	public void updateGoodsTopOrDel(Map<String, String> params, Map<String, Object> map);

	/*********** syy end ************************/

	public List<Map<String, String>> searShopAllGoodsListPage(String shopid, PageInfo page);

	public Map<String, Object> fujinGoods(String type, String pageCount, String cityid, String obj);

	public Map<String, Object> fujinShop(String type, String cityid, String jd, String wd);

	// 分享商品信息
	public Map<String, Object> shareProInfo(String proid);

	public Map<String, Object> shareProDetail(@Param("proid") String proid);

	public List<Map<String, Object>> searGoodsActTypeListPage(String typeid, String cityid, String name,
			PageInfo pageInfo);

	/**
	 * 得到某个商品购买的总数
	 * 
	 * @param goodsId
	 * @return
	 */
	public Integer getSoldedGoodsCount(long goodsId);

	/**
	 * 批量下架商品
	 * 
	 * @param goodsIds
	 *            商品id
	 * @param type
	 *            1:上架; 2:下架
	 */
	public int batchUpdateGoodsStatus(Long[] goodsIds, int status);

	/**
	 * 查询店铺的热销产品
	 * 
	 * @param shop_id
	 * @param page
	 * @return
	 */
	public List<Map<String, Object>> searchHotSaleGoodsByShopId(String shop_id, PageInfo page);

	public List<Map<String, Object>> searchMyGoodsPage(String u_id, PageInfo page);

	public List<Map<String, Object>> getAllGoodTypes();

	public LinkedList<ApiSpeicalChang> searchSpecailChangList(Map<String, Object> conditions, PageInfo pageInfo);

	public void addSpeicalChang(ApiSpeicalChang apiSpeicalChang);

	public List<ApiGoods> searchGoodsByType(int typeId, String topicId, String flag, String userId);

	public void batchInsertTopicLink(List<ApiGoodsTopicLink> list);

	public List<Map<String, Object>> getGoodInfoByCondition(String key, String is_recommend);

	public Map<String, Object> getGoodInfoByGoodId(int goodId, String userId, String topicId);

	// 获取收藏的商品列表
	public List<ApiGoods> findGoodsList(String user_id, Integer type, PageInfo page);
}
